package examination_online.controller;

import examination_online.service.impl.UserService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.sql.SQLException;

/**
 * @Auther: GongXl
 * @Date: 028 17:55
 * @Description:
 * ## SpringMvc Spirng
 * springmvc跳转： https://blog.csdn.net/figo0423/article/details/79759151
 */
@Controller
@RequestMapping("/user")
public class UserController {
    private static Logger logger = Logger.getLogger(UserController.class);
    @Autowired
    public UserService userService;
    /**
     * 根据id查询user
     * @return
     */
    @RequestMapping("/findUserById")
    public String findUserById(Model model) throws SQLException {
        System.out.println("findUserById ....");

        // 记录debug级别的信息
        logger.debug("This is debug message.");
        // 记录info级别的信息
        logger.info("This is info message.");
        // 记录error级别的信息
        logger.error("This is error message.");
        userService.findUserById(1);
        return "userInfo";
    }
}